package io.renren.modules.cards.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.modules.cards.entity.AmgCdkUsersEntity;
import io.renren.modules.cards.service.AmgCdkUsersService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;

/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2018-09-03 15:06:23
 */
@RestController
@RequestMapping("cards/amgcdkusers")
public class AmgCdkUsersController {
    @Autowired
    private AmgCdkUsersService amgCdkUsersService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("cards:amgcdkusers:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = amgCdkUsersService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("cards:amgcdkusers:info")
    public R info(@PathVariable("id") Integer id){
			AmgCdkUsersEntity amgCdkUsers = amgCdkUsersService.selectById(id);

        return R.ok().put("amgCdkUsers", amgCdkUsers);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("cards:amgcdkusers:save")
    public R save(@RequestBody AmgCdkUsersEntity amgCdkUsers){
			amgCdkUsersService.insert(amgCdkUsers);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("cards:amgcdkusers:update")
    public R update(@RequestBody AmgCdkUsersEntity amgCdkUsers){
			amgCdkUsersService.updateById(amgCdkUsers);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("cards:amgcdkusers:delete")
    public R delete(@RequestBody Integer[] ids){
			amgCdkUsersService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }

}
